//
// Created by dengpan on 17-6-14.
//

#include "iostream"
#include "fstream"

int main() {
    std::string fileName = "/home/dengpan/Videos/1read3.mp4";
    std::string copyFile = "/home/dengpan/Videos/1.mp4";

    char buf[256];
    std::ifstream in(fileName, std::ios::binary | std::ios::in);
    std::ofstream out(copyFile, std::ios::binary | std::ios::out);
    int n = 0;
    //总的字节数
    int num = 0;
    while (!in.eof()) {
        in.read(buf, 256);
        n = in.gcount();
        num += n;
        out.write(buf,n);
    }

    in.close();
    out.close();

    return 0;
}
